package easyScript.plugins.testPlugin;

import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;


public class TestPlugin extends Stage {
    public TestPlugin() {
        super();
        Pane root = getRoot();
        Scene scene = new Scene(root, 500, 500);
//        scene.setOnKeyPressed(System.out::println);
        scene.setFill(null);
        this.setTitle("计算器");
        this.setScene(scene);
        this.show();
        this.setAlwaysOnTop(false);


    }

    Pane getRoot() {
        BorderPane anchorPane = new BorderPane();
        anchorPane.setCenter(new HBox());
        GridPane nums = new GridPane();
        nums.setHgap(10);  // 设置水平间距
        nums.setVgap(15);
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                Label label = new Label(String.valueOf(i * 3 + j + 1));
                label.setPrefWidth(90);
                label.setPrefHeight(90);
                label.setAlignment(Pos.CENTER);
                label.setStyle("-fx-background-color: #2196F3; " + "-fx-font-size:45px;");

                label.setOnMouseEntered(e -> {
                    label.setStyle("-fx-background-color: #1976D2; " + "-fx-font-size: 55px;");
                });
                label.setOnMouseExited(e -> {
                    label.setStyle("-fx-background-color: #2196F3; " + "-fx-font-size: 45px;");
                });


                nums.add(label, j, i);
            }
        }


        anchorPane.setBottom(nums);

        return anchorPane;
    }
}
